<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<img src="" alt="">
<input type="file" onchange="text(this)">
</body>
</html>
<script type="application/javascript">
function text(e){
    var link = document.querySelector("img");
    console.log(link)
    var read = new FileReader();
    read.readAsDataURL(e.files[0]);
    read.onload = function (e) {
        link.src =  e.target.result;
    }
}
function permute (input) {
    var parm = [],
        user = [];
    return (function main(input) {
        var ch;
        input.forEach((el, i) =>{
            ch = input.splice(i,1)[0]
            user.push(ch)
            if(!input.length){
                parm.push(user.join())
            }
            console.log(i,ch,input,user,111)
            main(input)
            input.splice(i,0, ch)
            user.pop()
            console.log(i,ch,input,user,222)
        })
        return parm
    })(input)
}
console.log(permute(['a','b','c']))
</script>